<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich" 
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <ui:composition>
        <h:head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>支出证明单</title>
            <script language="javascript">
                function showProj() {
                    window.open("./pubinfo/projList.jsf", "项目列表", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
                }
                function updateProjSelect(code, name) {
                    document.getElementById('fm_cp:projCode').value = code;
                    document.getElementById('fm_cp:projName').value = name;
                }

                function showDept() {
                    window.open("./pubinfo/departmentList.jsf", "部门列表", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
                }
                function updateDept(code, name) {
                    document.getElementById('fm_cp:deptcode').value = code;
                    document.getElementById('fm_cp:deptname').value = name;
                }
                function showCostItem() {
                    window.open("./pubinfo/costItemList.jsf", "经济分类", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
                }
                function updateCostItemName(code, name) {
                    document.getElementById('fm_cp:costcode').value = code;
                    document.getElementById('fm_cp:costname').value = name;
                }
            </script>
            <style type="text/css">
                input[type='text'],select{
                    width: 120px !important;
                }
            </style>
        </h:head>
        <h:body>
            <h:form id="fm_cp">
                <rich:panel styleClass="content-hight">

                    <rich:collapsiblePanel   header="查询条件"  switchType="client" expanded="false">
                        <h:panelGrid columns="4" >
                            <h:outputLabel value="单据编号：" for="number" />
                            <h:inputText id="number" value="#{proof.qlb.number}" />
                            <h:outputText value="单据日期："/>
                            <h:panelGroup>
                                <rich:calendar value="#{proof.qlb.numDateStart}"
                                               locale="zh_CN"
                                               popup="true"
                                               datePattern="yyyy-MM-dd"
                                               showApplyButton="false"/>
                                至
                                <rich:calendar value="#{proof.qlb.numDateEnd}"
                                               locale="zh_CN"
                                               popup="true"
                                               datePattern="yyyy-MM-dd"
                                               showApplyButton="false"/>
                            </h:panelGroup>
                            <h:outputLabel value="报销内容：" for="affair" />
                            <h:inputText id="affair" value="#{proof.qlb.affair}" />
                            <h:outputLabel value="报销金额：" />
                            <h:panelGroup>
                                <h:inputText id="totalStart" value="#{proof.qlb.totalStart}"/>
                                - <h:inputText id="totalEnd" value="#{proof.qlb.totalEnd}"/>
                            </h:panelGroup>
                            <h:outputLabel value="预算项目：" for="projName" />
                            <h:inputText id="projName" value="#{proof.qlb.project.finName}"
                                         onclick="#{rich:component('projPanel')}.show();" />
                            <h:outputLabel value="核定金额：" />
                            <h:panelGroup>
                                <h:inputText id="checkaccountStart" value="#{proof.qlb.checkaccountStart}"/>
                                - <h:inputText id="checkaccountEnd" value="#{proof.qlb.checkaccountEnd}"/>
                            </h:panelGroup>
                            <h:outputText value="审核日期："/>
                            <h:panelGroup>
                                <rich:calendar value="#{proof.qlb.auditDateStart}"
                                               locale="zh_CN"
                                               popup="true"
                                               datePattern="yyyy-MM-dd"
                                               showApplyButton="false"/>
                                至
                                <rich:calendar value="#{proof.qlb.auditDateEnd}"
                                               locale="zh_CN"
                                               popup="true"
                                               datePattern="yyyy-MM-dd"
                                               showApplyButton="false"/>
                            </h:panelGroup>
                            <h:outputLabel value="支付金额：" />
                            <h:panelGroup>
                                <h:inputText id="payaccountStart" value="#{proof.qlb.payaccountStart}"/>
                                - <h:inputText id="payaccountEnd" value="#{proof.qlb.payaccountEnd}"/>
                            </h:panelGroup>
                            <h:outputText value="支付日期："/>
                            <h:panelGroup>
                                <rich:calendar value="#{proof.qlb.payDateStart}"
                                               locale="zh_CN"
                                               popup="true"
                                               datePattern="yyyy-MM-dd"
                                               showApplyButton="false"/>
                                至
                                <rich:calendar value="#{proof.qlb.payDateEnd}"
                                               locale="zh_CN"
                                               popup="true"
                                               datePattern="yyyy-MM-dd"
                                               showApplyButton="false"/>
                            </h:panelGroup>                           
                        </h:panelGrid>
                    </rich:collapsiblePanel>                   

                    <h:commandButton value="查询" action="#{proof.proofQuery}"/>
                    <h:commandButton value="取消" action="#{proof.queryCancel}"/>
                    <h:commandButton value="导出Excel" action="#{proof.exportExcel}" disabled="#{proof.billModel.rowCount le 0}" />

                    <div style="width:100%;overflow:auto">
                        <rich:dataTable id="proofList" value="#{proof.billModel}" var="bill" rows="10" 
                                        style=" width: 1400px;"
                                        noDataLabel="......">
                            <rich:column sortBy="#{bill.number}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="单据编号"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:commandLink action="#{proof.showBill}" immediate="true">
                                    <h:outputText value="#{bill.number}"/>
                                </h:commandLink>
                            </rich:column>

                            <rich:column sortBy="#{bill.numDate}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="单据日期"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.numDate}">
                                    <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                                </h:outputText>
                            </rich:column>

                            <rich:column sortBy="#{bill.numberStatus}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="单据状态"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="等待审核"  rendered="#{bill.numberStatus == '0'}" style="color:green"/>
                                <h:outputText value="未提交"    rendered="#{bill.numberStatus == '1'}"/>
                                <h:outputText value="审核通过"  rendered="#{bill.numberStatus == '2'}" style="color:blue"/>
                                <h:outputText value="退回修改"  rendered="#{bill.numberStatus == '3'}" style="color:red"/>
                                <h:outputText value="确认支付"  rendered="#{bill.numberStatus == '4'}" style="color:blue"/>
                                <h:outputText value="支付完毕"  rendered="#{bill.numberStatus == '6'}" style="color:blue"/>
                            </rich:column>
                            <rich:column sortBy="#{bill.payDept.name}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="部门"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.payDept.name}"/>
                            </rich:column>
                            <rich:column sortBy="#{bill.feePer.cpsn_name}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="经手人员"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.feePer.cpsn_name}"/>
                            </rich:column>
                            <rich:column sortBy="#{bill.project.finName}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="预算项目"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.project.finName}"/>
                            </rich:column>
                            <rich:column sortBy="#{bill.affair}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="报销内容"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.affair}"/>
                            </rich:column>

                            <rich:column sortBy="#{bill.total}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="报销金额"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.total}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>        

                            <rich:column sortBy="#{bill.costClass}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="支出类别"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.costClass}"/>
                            </rich:column>

                            <rich:column sortBy="#{bill.budgetSource}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="预算来源"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.budgetSource}"/>
                            </rich:column>

                            <rich:column sortBy="#{bill.costitem.name}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="经济分类:"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.costitem.name}"/>
                            </rich:column>

                            <rich:column sortBy="#{bill.costTypes.name}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="支出渠道:"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.costTypes.name}"/>
                            </rich:column>

                            <rich:column sortBy="#{bill.paycode}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="支付令"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.paycode}" style="width:350px" />
                            </rich:column>

                            <rich:column sortBy="#{bill.checkaccount}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="核定金额"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.checkaccount}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>

                            <rich:column sortBy="#{bill.repayment}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="还款金额"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.repayment}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>

                            <rich:column sortBy="#{bill.remain}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="待支付金额"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.remain}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>

                            <rich:column sortBy="#{bill.auditDate}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="审核日期"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.auditDate}">
                                    <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                                </h:outputText>
                            </rich:column>

                            <rich:column sortBy="#{bill.auditor}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="审核人"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.auditor}"/>
                            </rich:column>

                            <rich:column sortBy="#{bill.payaccount}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="支付金额"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.payaccount}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>

                            <rich:column sortBy="#{bill.payDate}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="支付日期"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.payDate}">
                                    <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                                </h:outputText>
                            </rich:column>

                            <rich:column sortBy="#{bill.payer}">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="出纳"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{bill.payer}"/>
                            </rich:column>

                            <f:facet name="footer">
                                <rich:dataScroller id="ds"></rich:dataScroller>
                            </f:facet>
                        </rich:dataTable>
                    </div>
                </rich:panel>
            </h:form>
            <rich:popupPanel id="projPanel" autosized="true">
                <f:facet name="header">项目信息</f:facet>
                <f:facet name="controls">
                    <h:outputLink value="#" onclick="#{rich:component('projPanel')}.hide();">关闭</h:outputLink>
                </f:facet>
                <h:form id="projList">
                    <rich:dataTable id="editTable" value="#{proof.finProjModel}" rows="10"  var="pro"
                                    onrowmouseover="this.style.backgroundColor='#F1F1F1'"
                                    onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                                    rowClasses="list-row-odd,list-row-even">
                        <rich:column>
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="预算项目编码"/>
                                </h:panelGroup>
                            </f:facet>
                            <a4j:commandLink id="Projlinks" action="#{proof.selectProjForQuery}"
                                             onclick="#{rich:component('projPanel')}.hide();"
                                             render="projName" >
                                <h:outputText value="#{pro.finCode}"/>
                            </a4j:commandLink>
                        </rich:column>

                        <rich:column>
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="预算项目名称"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{pro.finName}"/>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="备注"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{pro.memo}"/>
                        </rich:column>

                        <f:facet name="footer">
                            <rich:dataScroller id="ds"></rich:dataScroller>
                        </f:facet>
                    </rich:dataTable>
                </h:form>
            </rich:popupPanel>
        </h:body>
    </ui:composition>
</html>

